//
//  UIImage+Mango.h
//  Mango
//
//  Created by 胡超 on 2018/1/29.
//  Copyright © 2018年 胡超., ltd. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

/** MGColor仅支持UIColor类型和NSString类型，如果是NSString类型，则格式为@"#FF0000"，颜色16进制字符串*/
typedef id MGColor;

@interface UIImage (Mango)

/** -[UIImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]*/
@property (nonatomic,readonly) UIImage *originalRenderingImage;

+ (instancetype)image:(MGColor)color;
+ (instancetype)image:(MGColor)color size:(CGSize)size;
+ (instancetype)image:(MGColor)color size:(CGSize)size cornerRadius:(CGFloat)cornerRadius;
+ (instancetype)gradientImage:(NSArray<MGColor> *)colors;
+ (instancetype)gradientImage:(NSArray<MGColor> *)colors size:(CGSize)size;
+ (instancetype)gradientImage:(NSArray<MGColor> *)colors start:(CGPoint)start end:(CGPoint)end;
+ (instancetype)gradientImage:(NSArray<MGColor> *)colors start:(CGPoint)start end:(CGPoint)end size:(CGSize)size;
+ (instancetype)gradientImage:(NSArray<MGColor> *)colors locations:(nullable NSArray<NSNumber *>*)locations start:(CGPoint)start end:(CGPoint)end size:(CGSize)size;

- (UIImage *)clipCornerRadius:(CGFloat)cornerRadius;

/** 图片缩放*/
- (UIImage *)scaleTo:(CGSize)size;
/** 图片着色*/
- (UIImage *)fill:(MGColor)color;

@end

NS_ASSUME_NONNULL_END
